<template>
  <el-card class="box-card">
    <template #header>
      <div class="card-header">
        <h3>文档</h3>
      </div>
    </template>
    <div class="item-box">
      <div
        v-for="(item, index) in document.list"
        :key="index"
        class="item"
        @click="to(item.url)"
      >
        <div class="h">
          <img class="logo" :src="item.image" alt="" srcset="" />
          <span>{{ item.title }}</span>
        </div>

        <div class="des">
          <el-text truncated size="small">{{ item.des }}</el-text>
        </div>
      </div>
    </div>
  </el-card>
</template>

<script setup lang="ts">
import {
  ref,
  reactive,
  toRefs,
  watch,
  onMounted,
  nextTick,
  getCurrentInstance,
} from 'vue'
import type { PropType } from 'vue'

const emit = defineEmits([''])
const props = defineProps({
  propData: {
    type: String,
    default: '',
  },
})
//const { } = toRefs(props);

const to = (url: string) => {
  window.open(url)
}

const document = reactive({
  list: [
    {
      title: 'vue',
      des: '渐进式 JavaScript 框架',
      image:
        'https://tse3-mm.cn.bing.net/th/id/OIP-C.pkLf8JxlAYw5x69ZEkMSswAAAA?pid=ImgDet&rs=1',
      url: 'https://cn.vuejs.org/',
    },
    {
      title: 'react',
      des: '渐进式 JavaScript 框架',
      image:
        '',
      url: 'https://react.docschina.org/learn',
    },

    {
      title: 'element-plus',
      des: '一款国内热门的vue3组件库',
      image:
        'https://tse3-mm.cn.bing.net/th/id/OIP-C.DQErt06dt0JSewG_vNNEwAAAAA?w=148&h=175&c=7&r=0&o=5&dpr=1.3&pid=1.7',
      url: 'https://element-plus.gitee.io/zh-CN/component/button.html',
    },
    {
      title: 'vue',
      des: '渐进式 JavaScript 框架',
      image: 'https://cn.vuejs.org/',
      url: 'https://cn.vuejs.org/',
    },
    {
      title: 'vue',
      des: '渐进式 JavaScript 框架',
      image: 'https://cn.vuejs.org/',
      url: 'https://cn.vuejs.org/',
    },
    {
      title: 'vue',
      des: '渐进式 JavaScript 框架',
      image: 'https://cn.vuejs.org/',
      url: 'https://cn.vuejs.org/',
    },
    {
      title: 'vue',
      des: '渐进式 JavaScript 框架',
      image: 'https://cn.vuejs.org/',
      url: 'https://cn.vuejs.org/',
    },
  ],
})

const { data } = toRefs(
  reactive({
    //定义数组和对象
    data: '',
  })
)
</script>
<style lang="scss" scoped>
.item-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
.item {
  width: 30%;
  height: auto;
  border: 1px solid #e5e6eb;
  margin-bottom: 10px;
  border-radius: 3px;
  box-sizing: border-box;
  padding: 10px;

  .h {
    display: flex;
    align-items: center;
  }
  .logo {
    width: 25px;
    height: 25px;
    margin-right: 10px;
  }

  .des {
    margin-top: 20px;
    font-size: 0.8rem;
  }
}
</style>
